package com.rabbiter.oes.mapper;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.rabbiter.oes.entity.Subject;
import com.rabbiter.oes.vo.SubjectListVO;
import org.apache.ibatis.annotations.Mapper;

@Mapper
public interface SubjectMapper extends BaseMapper<Subject> {


    IPage<SubjectListVO> findPage(Page page, String name);

    default Long findCountByName(String name) {
        LambdaQueryWrapper<Subject> wrapper = new LambdaQueryWrapper<>();
        wrapper.apply("name='" + name.concat("'"));
        return selectCount(wrapper);
    }

}
